/*
 * $Id$
 */
package corejs.parser;

import corejs.Token;
import corejs.expr.AssignmentExpr;
import corejs.expr.Expression;

/**
 *
 * @author myang
 */
public class AssignmentParser implements InfixParser {

   @Override
   public AssignmentExpr expr(final PrattParser parser,
                              final Expression left,
                              final Token tk) {
      final Expression right = parser.expr(Precedence.ASSIGNMENT - 1);
      return new AssignmentExpr(left, right);
   }

   @Override
   public int getPrecedence() {
      return Precedence.ASSIGNMENT;
   }
}
